﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using App1AppHandler;

namespace Reborn_Server.App1AppHandler
{
    public class Spell_Resurrection : TargetSpell
    {
        public void Cast(CreatureBase myCreatureBase, int CastLevel, long CreatureGUID)
        {
            List<MapItem> MapItemsWithin12;
            if (base.InitializeCast(myCreatureBase, CastLevel, CreatureGUID, false, out MapItemsWithin12) == false)
                return;

            CorpseCharacter corpse = myCreatureBase.GameHandler.GetMap(myCreatureBase.MapID, myCreatureBase.Instance).LootMngr.GetFirstCharacterCorpse(myCreatureBase.MapX, myCreatureBase.MapY);
            if (corpse != null)
            {
                if (spellIcon.Name.IndexOf("Rank 2") > -1)
                {
                    myCreatureBase.GameHandler.Resurrect(corpse.MyCharacter, myCreatureBase.MapID, myCreatureBase.MapX, myCreatureBase.MapY, 50, true);
                }
                else
                    myCreatureBase.GameHandler.Resurrect(corpse.MyCharacter, myCreatureBase.MapID, myCreatureBase.MapX, myCreatureBase.MapY, 75, true);
                
                myCreatureBase.SendMessage("You ressurect " + corpse.MyCharacter.Name + "!", "spelldefense");
                corpse.MyCharacter.SendMessage(myCreatureBase.Name + " ressurects you!", "spelldefense");
            }
        }
    }
}
